# 文章相关路由
from flask import request, jsonify
from models import *


def register_article_routes(app):
    @app.route('/plantACR/createArticle', methods=['POST'])
    def create_article():
        resultVO = {
            "code": 200,
            "data": {}
        }
        try:
            data = request.get_json()
            '''
            相关逻辑
            '''
            db.session.commit()
            resultVO["message"] = '文章创建成功'
            return jsonify(resultVO)
        except Exception as e:
            db.session.rollback()
            resultVO["code"] = 500
            resultVO["message"] = "文章创建失败：" + str(e)
            return jsonify(resultVO)

    return app
